using System;
using System.Drawing;
using System.Collections.Generic;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace Beauty.Module.Pos
{
    public partial class ServicesVCtrl : UIViewController
    {

		List<ServiceItem> listServicesItem;
		public  bool isGrid = false;
		 
		static NSString tableProductCellId = new NSString("tableCell");
		static NSString gridProductCellId = new NSString("gridCell");
        public ServicesVCtrl()
            : base("ServicesVCtrl", null)
        {

			listServicesItem = new List<ServiceItem> ();

			for (int i = 0; i < 12; i++) {
				var servicesItem = new ServiceItem ();
				listServicesItem.Add (servicesItem);
			}
        }

        public override void DidReceiveMemoryWarning()
        {
            // Releases the view if it doesn't have a superview.
            base.DidReceiveMemoryWarning();

            // Release any cached data, images, etc that aren't in use.
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


			servicesCollection.Layer.BorderWidth = 1f;

			servicesCollection.Layer.BorderColor = UIColorExtensions.FromHexString("#b2b2b2").CGColor;

			servicesCollection.RegisterClassForCell (typeof(serviceCell), gridProductCellId);
			servicesCollection.RegisterClassForCell (typeof(servicesCellList), tableProductCellId);
			servicesCollection.RegisterClassForSupplementaryView (typeof(Header1), UICollectionElementKindSection.Header, new NSString ("Header"));
			servicesCollection.RegisterClassForSupplementaryView (typeof(Footer1), UICollectionElementKindSection.Footer, new NSString ("Footer"));
			 
			 
		 
 

			UIView viewRight = new UIView (new RectangleF(660, 20, 340, 650));
			viewRight.Layer.CornerRadius = 5f;
			viewRight.BackgroundColor = UIColor.White;
			UIView viewRightTop = new UIView (new RectangleF(0, 0, 340, 50));
			viewRightTop.BackgroundColor = UIColorExtensions.FromHexString ("#a1a1a1");
			UIImage imageCreate = UIImage.FromFile ("ic_createjs.png");
			UIButton cmdCreate = new UIButton (UIButtonType.Custom);
			cmdCreate.SetBackgroundImage (imageCreate, UIControlState.Normal);
			cmdCreate.Frame = new RectangleF (290, 0, 50, 50);



			UIImageView  imagePay = new UIImageView( UIImage.FromFile ("bt_pay0.png"));
			imagePay.Frame = new RectangleF (20, 580, 300, 50);

			UILabel lbTotal = new UILabel (new RectangleF (150, 590, 250, 30));
			lbTotal.Text = "Pay $0";
			lbTotal.TextColor = UIColor.White;
			UIView line = new UIView (new RectangleF (0, 550, 340, 1));



			line.BackgroundColor = UIColorExtensions.FromHexString ("#b2b2b2");


			View.BackgroundColor = UIColorExtensions.FromHexString ("#ebeef0");
			viewRight.Layer.BorderWidth = 1f;
			viewRight.Layer.BorderColor = UIColorExtensions.FromHexString("#b2b2b2").CGColor;


			viewRight.AddSubview (viewRightTop);
			viewRight.AddSubview (cmdCreate);
			viewRight.AddSubview (imagePay);
			viewRight.AddSubview (lbTotal);
			viewRight.AddSubview (line);
			 
			 Add (viewRight);
        }
		public override void ViewWillAppear (bool animated)
		{
			base.ViewWillAppear (animated);
			servicesCollection.SetCollectionViewLayout (new productLayout (), true);
			servicesCollection.Source = new serviecsCollectionSource (listServicesItem ,0);

		}
		public void changeLayout ()
		{
			if (!isGrid) {
				servicesCollection.SetCollectionViewLayout (new productLayoutList (), false);
				servicesCollection.Source = new serviecsCollectionSource (listServicesItem, 1);
				 
				isGrid = true;
			} else {
				servicesCollection.SetCollectionViewLayout (new productLayout (), false);
				servicesCollection.Source = new serviecsCollectionSource (listServicesItem, 0);
			 
				isGrid = false;
			}
		}
    }
}